/**
 * 
 */
package uit.comstore.model.entity;

import java.io.Serializable;
import java.math.BigDecimal;

import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @author XIII
 *
 */
@Entity
@Table(name="Revenues")
@AssociationOverrides({@AssociationOverride(name="month", joinColumns=@JoinColumn(name="Month")),
						@AssociationOverride(name="year", joinColumns=@JoinColumn(name="Year"))})
@SuppressWarnings("serial")
public class Revenue implements Serializable {

	private RevenuePK revenuePK = new RevenuePK();
	private BigDecimal total;
	
	@EmbeddedId
	public RevenuePK getRevenuePK() {
		return revenuePK;
	}
	public void setRevenuePK(RevenuePK revenuePK) {
		this.revenuePK = revenuePK;
	}
	
	@Column(name="RevenueTotal")
	public BigDecimal getTotal() {
		return total;
	}
	public void setTotal(BigDecimal total) {
		this.total = total;
	}
	
	@Transient
	public Integer getMonth() {
		return getRevenuePK().getMonth();
	}
	public void setMonth(Integer month) {
		getRevenuePK().setMonth(month);
	}
	
	@Transient
	public Integer getYear() {
		return getRevenuePK().getYear();
	}
	public void setYear(Integer year) {
		getRevenuePK().setYear(year);
	}
}
